/**
 * 
 */
package com.sft.main.spring_session.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author sft
 *
 *         2016年4月21日
 */
@Controller
@RequestMapping("testSession")
public class TestSession {
	@RequestMapping("/get")
	@ResponseBody
	public String get(HttpServletRequest request, HttpServletResponse response) {
		HttpSession session = request.getSession();
		Object aa = session.getAttribute("aa");
		System.out.println(aa);
		return "get="+aa;
	}
	@RequestMapping("/set")
	@ResponseBody
	public String set(HttpServletRequest request, HttpServletResponse response) {
		HttpSession session = request.getSession();
		session.setAttribute("aa", 12345);
		return "set";
	}
	@RequestMapping("/destroy")
	@ResponseBody
	public String  destroy(HttpServletRequest request){
		HttpSession session = request.getSession();
		session.invalidate();
		return "destroy";
	}
}
